﻿using System.Windows;
using GurLoader.Preferences;
using GurLoader.Util;
using GurLoader.ViewModel;
using Moq;
using NUnit.Framework;

namespace GurLoaderWPF.Test.ViewModel
{
    [TestFixture]
    public class NotifyTrayViewModelTests
    {
        [Test]
        public void TestExitApplicationCommand()
        {
            Mock<GurLoaderPreferences> mockPreferences = new Mock<GurLoaderPreferences>();
            Mock<IApplication> mockApplication = new Mock<IApplication>();
            Mock<ICommandManager> mockCommandManager = new Mock<ICommandManager>();

            mockApplication.Setup(x=>x.Shutdown()).Verifiable();

            NotifyTrayViewModel vm = new NotifyTrayViewModel(mockPreferences.Object, mockApplication.Object, mockCommandManager.Object);

            Assert.IsNotNull(vm.ExitApplicationCommand);
            Assert.IsTrue(vm.ExitApplicationCommand.CanExecute(null));

            vm.ExitApplicationCommand.Execute(null);

            mockPreferences.VerifyAll();
            mockApplication.VerifyAll();
            mockCommandManager.VerifyAll();
        }
    }
}
